<?php

namespace App\Exceptions\Frontend;

use App\Http\Resources\Frontend\ApiResource;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
use Throwable;

class ApiException extends Exception
{

    public function __construct($message = "", $code = 0, Throwable $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }

    /**
     * @param Request $request
     * @return JsonResource
     */
    function render($request){
        return new ApiResource($this->message, $this->code);
    }
}
